package cn.com.self.apis.sms.service.impl;

import cn.com.self.apis.sms.mapper.SmsTblMapper;
import cn.com.self.apis.util.CopyUtils;
import cn.com.selfsoft.smartcity.commons.http.ResultModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import cn.com.self.apis.sms.entity.SmsTbl;
import cn.com.self.apis.sms.service.ISmsTblService;
import cn.com.selfsoft.smartcity.core.service.BaseServiceImpl;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liangwt
 * @since 2020-05-29
 */
@Service
public class SmsTblServiceImpl extends BaseServiceImpl<SmsTbl, String> implements ISmsTblService {

    @Autowired
    private SmsTblMapper smsTblMapper;
    @Override
    public ResponseEntity deleteSms(String id) {
        SmsTbl entity = new SmsTbl();
        entity.setId(Long.getLong(id));
        entity.setDelFlag("1");
        SmsTbl smsTbl = this.smsTblMapper.selectById(id);
        CopyUtils.copyProperties(entity, smsTbl);
        this.update(smsTbl);
        return ResponseEntity.status(HttpStatus.OK).body(new ResultModel<>(1));
    }
}
